﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<div class="modal-dialog demo2do-modal-dialog" style="width:1000px;">

  <div class="modal-content">

    <div class="modal-header beast-breadcrumb no-bottom-border clearfix">

      <h2><i class="glyphicon glyphicon-fire" title=""></i>&nbsp;&nbsp;<span>编辑社交账户信息</span></h2>

      <button type="button" class="close" data-dismiss="modal">&times;</button>

    </div>

    <form class="form-horizontal" method="POST" action="${ctx.host}/customers/${customer.id}/social-account/${socialAccount.id}" data-validate="true">

      <input type="hidden" name="_method" value="PATCH" >
      
      <div class="modal-body">

        <div class="form-group demo2do-form-group">
          <label class="col-xs-2 control-label">账号</label>
          <div class="pull-left" style="width: 30%;">
            <p class="form-control-static">${socialAccount.code}</p>
          </div>
          <label class="col-xs-2 control-label">账号昵称</label>
          <div class="pull-left" style="width: 30%;">
            <input type="text" class="form-control" name="nickName" value="${socialAccount.nickName}">
          </div>
        </div>
        
        <c:choose>
		   <c:when test="${type == 'WECHAT'}">  
		         <div class="form-group demo2do-form-group">
				  <label class="col-xs-2 control-label">报价</label>
		          <div class="pull-left" style="width: 30%;">
		          	<%-- <p class="form-control-static"><fmt:formatNumber value="${socialAccount.estimatePrice/100}" pattern="#.##"/></p> --%>
		          	<!-- 报价先默认10元   -->
		            <p class="form-control-static">￥&nbsp;<fmt:formatNumber value="${variable.value }" pattern="#.##"/></p>
		          </div>
		          <div class="form-group demo2do-form-group">
			          <label class="col-xs-2 control-label">账号状态</label>
			          <div class="pull-left" style="width: 30%;">
			            <p class="form-control-static"><label class="label label-${socialAccount.auditStatus.css}">${socialAccount.auditStatus.description}</label></p>
			          </div>
			      </div>
		        </div>
		   </c:when>
		   <c:otherwise> 
				<div class="form-group demo2do-form-group">
				  <label class="col-xs-2 control-label">报价</label>
		          <div class="pull-left" style="width: 30%;">
		          	<%-- <p class="form-control-static"><fmt:formatNumber value="${socialAccount.estimatePrice/100}" pattern="#.##"/></p> --%>
		          	<!-- 报价先默认10元   -->
		            <p class="form-control-static">￥&nbsp;<fmt:formatNumber value="${variable.value }" pattern="#.##"/></p>
		          </div>
		          <label class="col-xs-2 control-label">链接</label>
		          <div class="pull-left" style="width: 30%;">
		            <p class="form-control-static"><a href="${socialAccount.link}" target="_blank">${socialAccount.link}</a></p>
		          </div>
		        </div>
		   </c:otherwise>
		</c:choose>

        
          <c:choose>
	          <c:when test="${type == 'WECHAT'}">  
	          	<div class="form-group demo2do-form-group">
			       <label class="col-xs-2 control-label">好友数量</label>
			       <div class="pull-left" style="width: 30%;">
		            	<input type="text" class="form-control" name="fans" value="${socialAccount.fans}" data-validate="required|number">
		           </div>
		           <label class="col-xs-2 control-label">上传认证图片时间</label>
		           <div class="pull-left" style="width: 30%;">
		            	<p class="form-control-static"><fmt:formatDate value='${socialAccount.uploadTime}' pattern='yyyy-MM-dd HH:mm:ss' /></p>
		           </div>
		        </div>
			  </c:when>
			  <c:otherwise>
			  	<div class="form-group demo2do-form-group">
				   <label class="col-xs-2 control-label">粉丝数量</label>
				   <div class="pull-left" style="width: 30%;">
		            	<input type="text" class="form-control" name="fans" value="${socialAccount.fans}" data-validate="required|number">
		           </div>
				   <label class="col-xs-2 control-label">账号状态</label>
		           <div class="pull-left" style="width: 30%;">
		            	<p class="form-control-static"><label class="label label-${socialAccount.auditStatus.css}">${socialAccount.auditStatus.description}</label></p>
		           </div>
		         </div> 
		         <div class="form-group demo2do-form-group">  
		           <div class="form-group demo2do-form-group">
			          <label class="col-xs-2 control-label">上传认证图片时间</label>
			          <div class="pull-left" style="width: 30%;">
			            <p class="form-control-static"><fmt:formatDate value='${socialAccount.uploadTime}' pattern='yyyy-MM-dd HH:mm:ss' /></p>
			          </div>
			       </div>
			     </div> 
			  </c:otherwise>
          </c:choose>
       
       <div class="form-group demo2do-form-group">      
          <label class="col-xs-2 control-label">认证图片</label>
          <div style="padding-top:6px;"><a href="${ctx.qiniu}/${socialAccount.picture}" target="_blank">查看大图</a></div>
          <div class="col-xs-8  pull-left" style="width: 100%;text-align:center;">
            <img src="${ctx.qiniu}/${socialAccount.picture}" style="width:300px;"/>
          </div>
        </div>
      </div>

      <div class="modal-footer">
        <button type="btn-ajax" class="btn btn-success btn-shadow btn-shadow-success demo2do-btn">确定</button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-default btn-shadow btn-shadow-default demo2do-btn" data-dismiss="modal">取消</button>
      </div>

    </form>

  </div>

</div>

<script src="${ctx.resource}/js/plupload.full.min.js"></script>
<script src="${ctx.resource}/js/qiniu.min.js"></script>
<script src="${ctx.resource}/js/bootstrap.validate.trigger.js"></script>
<script type="text/javascript">
  $(document).ready(function() {
    $('form').shiftform({
	     beforeSubmit:function(el){
	       $('form').trigger("validate.ajax.submit");
	       return $.bt_validate.result[$.bt_validate.form_id]    
	     }
    });
  });
</script>